﻿@model DataEntity.SysCompanyConfig

@{
    ViewBag.Title = "网站后台";
}
@*<script type="text/javascript" src="~/Scripts/View/homeManage.js"></script>*@
@*<link type="text/css" href="~/Scripts/jquery-easyui/plugins/portal/portal.css" rel="stylesheet" />
<script type="text/javascript" src="~/Scripts/jquery-easyui/plugins/portal/jquery.portal.js"></script>*@
<style>
    .BigIframe
    {
        overflow: hidden;
    }
</style>
<script>
  
    $(function ()
    {
        var _loadTreeData = function () {
            $('#menuTree').tree({
                url: "/Home/MenuListForTree",
                onClick: function (node) {
                    if (node.attributes.MenuUrl) {
                        if (node.attributes.MenuAccess) {
                            window.addTab({
                                title: node.text, href: node.attributes.MenuUrl, iconCls: node.iconCls, closable: true, selected: true, iniframe: true, bodyCls: 'BigIframe'});
                        }
                        else {
                            $.messager.alert('提示', '您没有权限使用此功能!', 'warning');
                        }
                    }
                },
                onContextMenu: function (e, node) {
                    e.preventDefault();
                    $(this).tree('select', node.target);
                    $('#treeContextMenu').menu('show', {
                        left: e.pageX,
                        top: e.pageY
                    });
                },
                onLoadSuccess: function (node, data) {
                    if (node == null) {
                        $('#menuTree').tree('expandAll');
                    }
                }
            });

        }
        var _bindMainFormButtonBarEvent = function () {
            window.addHomeTab();
            //主页
            $("a#a1", "#buttonbar").click(function () { window.jumpHomePageTab(); });
            
            ////修改密码
            $("a#a3", "#buttonbar").click(function () { ShowPassWordModify(); });
            //退出系统
            $("a#a4", "#buttonbar").click(function () { window.platform.exitSysConfirm(); });
            //注销登录
            $("a#a5", "#buttonbar").click(function () { window.platform.logoutConfirmAndExit(); });
            $.extend($("#home-layout").layout("panel", "north").panel("options"), {
                onCollapse: function () {
                    $("#north-toolbar").insertBefore("#home-layout"); $("#north-toolbar").css("top", 0); $("#btnShowNorth").show();
                    $("#buttonbar div:first").css("padding-right", "25px");
                },
                onExpand: function () {
                    $("#north-toolbar").insertAfter("#north-topbar"); $("#north-toolbar").css("top", 73); $("#btnShowNorth").hide();
                    $("#buttonbar div:first").css("padding-right", "0px");
                }
            });
            //隐藏顶部栏按钮事件
            $("#btnHideNorth").click(function () { $("#home-layout").layout("collapse", "north"); });
            //显示顶部栏按钮事件
            $("#btnShowNorth").click(function () { $("#home-layout").layout("expand", "north"); });

            //皮肤风格选择列表事件绑定
            $("#SkinMenu div").each(function () {
                $(this).bind("click", function () {
                    window.ChangeTheme($(this).attr("title"));
                    //window.saveUserDefaultTheme($(this).attr("title"));
                });
            });

        }
        _loadTreeData();
        _bindMainFormButtonBarEvent();

    })
    //更改系统主题皮肤
    window.ChangeTheme = function (themeName) {
        var easyuiTheme = $("link[href$='easyui.css']");
        var url = easyuiTheme.attr('href');
        var href = url.substring(0, url.indexOf('themes')) + 'themes/' + themeName + '/easyui.css';
        easyuiTheme.attr('href', href);

        var $iframe = $('iframe');
        if ($iframe.length > 0) {
            for (var i = 0; i < $iframe.length; i++) {
                var ifr = $iframe[i];
                $(ifr).contents().find("link[href$='easyui.css']").attr('href', href);
            }
        }
    };
    function ShowPassWordModify() {

        $("<div/>").attr({ id: "dd" }).dialog({
            title: '修改密码',
            width: 530,
            height: 250,
            closed: false,
            resizable: true,
            cache: false,
            iconCls: "icon-passwordedit",
            href: '/Account/PassWordModify',
            modal: true,
            //buttons: '#tb'
            buttons: [{
                text: '保存',
                iconCls: 'icon-save',
                handler: function () {
                    savePassWord($('#dd'));
                }
            },
            {
                text: '关闭',
                iconCls: 'icon-cancel',
                handler: function () {
                    $('#dd').dialog('close');
                    $('#dd').dialog('destroy');
                }
            }]


        });

    }
    window.savePassWord = function (dialog) {
        var verifyResult = $("form", dialog).form("validate");
        if (!verifyResult) { return false };
        var model = $(dialog).form().serializeObject();
        var _callback = function (result) {
            if (result.success) {
                $.messager.alert('操作提醒', '操作成功');
            } else {
                $.messager.alert('错误提醒', result.msg, 'error');
            }
            $('#dd').dialog('close');
            $('#dd').dialog('destroy');
        };

        $.post("/Account/PassWordModifySave", model, function (result) {
            _callback.call(this, result);
        }, 'json');
    };
</script>
<div style="width: 100%; height: 100%; min-width: 900px; min-height: 500px; overflow: hidden;">
    <div id="home-layout" class="easyui-layout" data-options="fit:true">
        <div id="home-north" data-options="region:'north'" style="overflow: hidden; height: 100px;
            border-top-width: 0px; border-left-width: 0px; border-right-width: 0px;">
            <div id="north-topbar">
                <div id="topbanner" style="position: absolute; top: 0px; left: 0px; height: 45px;">
                    <div id="dCorpTitle"></div>
                    <div id="dTitle">
                        <span style="font-size: x-large; line-height: 50px; font-weight: bold; padding-left: 10px;">
                         @if(Model!=null)
                         {
                            
                            <img src="/Content/logo/@Model.CompanyLogo" />@Model.CompanyName
                         }
                        else
                        {
                          @:后台管理
                         }
                        </span>
                    </div>
                </div>
                <div id="divNowTime" style="position: absolute; padding: 5px; right: 5px; z-index: 100;">
                    <label id="nowTime"></label>
                </div>
               <div style="top: 25px; position: absolute; right: 5px; width: 250px;">
                    <a href="javascript:void(0);" class="easyui-menubutton"
                        data-options="menu:'#SkinMenu',iconCls:'icon-skin'">皮肤更换</a>
                    <div id="SkinMenu" style="width: 135px;">
                        <div data-options="iconCls:'icon-tip'" title="default">
                            默认(天空蓝,推荐)
                        </div>
                        <div data-options="iconCls:'icon-tip'" title="gray">
                            灰霾(推荐)
                        </div>
                        <div data-options="iconCls:'icon-tip'" title="metro">
                            磁贴（白）
                        </div>
                        
                        <div data-options="iconCls:'icon-tip'" title="black">
                            金属黑(推荐)
                        </div>
                        <div data-options="iconCls:'icon-tip'" title="bootstrap">
                            银色
                        </div>
                    </div>
                    <div id="btnHideNorth" class="panel-tool">
                        <a href="javascript:void(0);" class="layout-button-up" title="隐藏顶部栏"></a>
                    </div>
                </div>
            </div>
            <div id="north-showbar" style="position: absolute; font-weight: normal; width: 100%;
                height: 18px; top: 45px; left: 0px; padding: 0px; padding-top: 1px; margin: 0px;
                border-left-width: 0px; border-right-width: 0px; z-index: 600;">
               @* <span style="color:red"><marquee scrollamount="5" scrolldelay="75" behavior="scroll">注：欢迎来到网站后台管理</marquee></span>*@
            </div>
            <div id="north-toolbar" style="position: absolute; font-weight: normal; width: 100%;
                height: 27px; top: 63px; left: 0px; padding: 0px; padding-top: 1px; margin: 0px;
                border-left-width: 0px; border-right-width: 0px; z-index: 600;">
                <div id="infobar" style="position: absolute; width: 250px; left: 0px; padding-top: 0px;">
                    <span style="padding-left: 5px;">
                     
                        用户：@ViewBag.RealName
                    </span>
                    
                </div>
               
                <div id="buttonbar" style="position: absolute; width: 500px; float: right; text-align: right;
                    right: 2px; padding-top: 0px;">
                    <div>
                        <a id="a1" class="easyui-linkbutton" href="javascript:void(0);" data-options="plain:true,iconCls: 'icon-homepage'"
                                title="打开或跳转到主页">主页</a>
                        
                        <a id="a3" href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-passwordedit',plain:true">修改密码</a>
                        <a id="a4" href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-quit',plain:true">
                            退出系统</a>
                        <a id="a5" href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-logout',plain:true">
                            注销登录</a>
                    </div>
                    <div id="btnShowNorth" class="panel-tool" style="display: none;">
                        <a href="javascript:void(0);" class="layout-button-down" title="显示顶部栏"></a>
                    </div>
                </div>
            </div>
        </div>

        <div id="home-west" data-options="region:'west',title:'菜单导航栏',split:true,border:false,iconCls:'icon-menunavi',minWidth:160,maxWidth:280"
            style="width: 180px; padding: 1px; overflow: hidden; border-right-width: 1px;">
            <ul id="menuTree">
            </ul>
        </div>

        <div id="home-center" data-options="region:'center',border:false" style="border-left-width:1px;">
            <div id="center-tabs" class="easyui-tabs" data-options="fit: true,border:false,defaultHref: '/Blank/BlankTab'">
            </div>
        </div>

        <div id="home-south" data-options="region: 'south', collapsed: true, iconCls: 'icon-about', title: '关于信息'"
            style="height: 80px; padding: 0px; background: #efefef;">
            <div style="color: #4e5766; padding: 8px 0px 0px 0px; margin: 0px auto; text-align: center;
                font-size: 12px; font-family: 微软雅黑;">
                #2012-2014 Copyright:MAX.&nbsp;&nbsp;|&nbsp;&nbsp;
                <br />
                建议使用&nbsp;
            <a href="http://windows.microsoft.com/zh-CN/internet-explorer/products/ie/home" target="_blank"
                style="text-decoration: none;">IE(Version 9/10)</a>/
            <a href="https://www.google.com/intl/zh-CN/chrome/browser/" target="_blank" style="text-decoration: none;">
                Chrome</a>
                &nbsp;系列浏览器。
            </div>
        </div>

    </div>

</div>